<template>
  <base-breadcrumb :breadcrumb="!isAudit">
    <a-card
      :bordered="false"
      style="margin-bottom: 20px"
    >
      <title-name title="基础信息" />
      <a-form layout="horizontal">
        <a-row :gutter="24">
          <a-col
            :md="16"
            :sm="16"
          >
            <a-form-item
              label="所属单位"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.viewName"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="项目设计管理类别"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.designTypeName"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
<!--          <a-col-->
<!--            :md="8"-->
<!--            :sm="8"-->
<!--          >-->
<!--            <a-form-item-->
<!--              label="分公司"-->
<!--              :label-col="{lg: {span: 5}, sm: {span:5}}"-->
<!--              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"-->
<!--            >-->
<!--              <BaseInput-->
<!--                v-model="dels.branchComName"-->
<!--                placeholder=""-->
<!--                disabled-->
<!--              />-->
<!--            </a-form-item>-->
<!--          </a-col>-->
        </a-row>
        <a-row :gutter="24">
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="设计资源名称"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.designResourceName"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="设计资源类型"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.designResourceType"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="合同范围"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.contractScope"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="年度时间"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.year"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="评价人"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.evalEmployeeName"
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="评价时间"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.evaluateTime"
                placeholder=""
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="评价总分"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.totalScore"
                disabled
              />
            </a-form-item>
          </a-col>
          <a-col
            :md="8"
            :sm="8"
          >
            <a-form-item
              label="评价等级"
              :label-col="{lg: {span: 5}, sm: {span:5}}"
              :wrapper-col="{lg: {span: 17}, sm: {span: 17} }"
            >
              <BaseInput
                v-model="dels.assessmentLevel"
                disabled
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>

      <title-name title="考核信息" />

      <!-- <div class="table-operator">
        <a-button
          type="primary"
          @click=""
        >
          导出
        </a-button>
      </div> -->

      <a-table
        ref="table"
        :pagination="false"
        bordered
        size="default"
        row-key="key"
        :columns="columns"
        :data-source="data"
        :alert="true"
        show-size-changer
        show-quick-jumper
        show-pagination="auto"
      >
        <span
          slot="serial"
          slot-scope="text, record, index"
        >{{ index + 1 }}</span>
      </a-table>
    </a-card>

    <div v-if="!isConsultation" class="page-btn-right-top">
    <!-- <div style="float:right;margin-top: 20px"> -->
      <a-button
        type="primary"
        @click="goBack"
      >
        关闭
      </a-button>
    </div>
  </base-breadcrumb>
</template>

<script>
import { STable, Ellipsis } from '@/components'
import { getResourceEvaluateDeltails } from '@/api/project/branchEvaluate'
import ARow from 'ant-design-vue/es/grid/Row'

export default {
  name: 'a' + Date.now(),
  components: {
    ARow
  },
  props: {
    // 是否作为审批详情
    isAudit: {
      type: Boolean,
      default: false
    },
    // 是否作为意见征询
    isConsultation: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      id: '',
      columns: [],
      data: [],
      dels: {
        viewName: ""
      } // 详情数据
    }
  },

  created() {
    this.id = this.$route.query.id
    this.getResourceEvaluateDeltailsReq()
  },
  computed: {},
  methods: {
    // 详情
    getResourceEvaluateDeltailsReq() {
      getResourceEvaluateDeltails({ id: this.id }).then((res) => {
        if (res.code == 200) {
          this.dels = res.data
          this.dels.viewName = this.dels.branchComName + '/' + this.dels.projectName
          this.columns = res.data.scoreHeader.map((el) => {
            if (el.title === '考核名称') {
              el.width = 300
            }
            if (el.title === '考核分类') {
              el.width = 200
            }
            if (el.title === '考核评分') {
              el.width = 100
              el.align = 'center'
            }
            if (el.title === '评分') {
              el.width = 100
              el.align = 'center'
            }
            return el
          })
          this.columns.unshift({
            title: '序号',
            width: 80,
            align: 'center',
            customRender: (text, record, index) => {
              return index + 1
            }
          })
          this.data = res.data.scoreContent
        }
      })
    },

    // 关闭
    goBack() {
      this.$router.push({ path: '/project/design/projectEvaluate' })
    }
  }
}
</script>
